<?php

namespace App\Http\Middleware;

use Closure;

class Guard
{
    private $whiteList = [
        'guard/login',
        'guard/upload',
        'guard/download',
        'guard/dev/getQr'
    ];
    public function handle($request, Closure $next) {

        $currentUrl = $request->path();
        //不在白名单且缺少 token的
        if(!in_array($currentUrl,$this->whiteList) && !$request->hasHeader('token')){
            return responseFail('缺少token！');
        }
        return $next($request);
    }
}
